package com.actionsoft.ActionEvent;

import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener;
import com.actionsoft.sdk.local.SDK;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class TaskFinish extends ExecuteListener implements ActionListener {


    @Override
    public void execute(ProcessExecutionContext pec) throws Exception {

        //1.获取上一个流程发起人（getCreateUserRoleId()）（接口 ProcessInstance）
        String uid = pec.getProcessInstance().getCreateUser();
        //获取流程表单中附带的ORG_ID,通过流程实例id获得
        Object departentId = SDK.getBOAPI().getByProcess("BO_EU_XIAOYOUHUIZUZHICHENGYUAN",pec.getProcessInstance().getId(),"ORG_ID");
        System.out.println("当前流程申请账户："+uid);
        //2.创建账户兼任信息createUserMap（ORGAPI中）
        SDK.getORGAPI().createUserMap(uid, (String) departentId,"acb05afd-b635-4f22-9b4c-c5d400c9b5b1",false,true);
    }

    @Override
    public void actionPerformed(ActionEvent e) {

    }
}

